﻿using System;
using System.Drawing;
using System.Drawing.Imaging;

namespace ru.yourpictures.Core.Imaging.Filters
{
    /// <summary>
    /// Cuts region from the source bitmap
    /// </summary>
    [FilterImplementation(GdiPlusImplemented = true, LowLevelImplemented = false)]
    public class Region : FilterBase
    {
        private Rectangle _regionInfo = new Rectangle();

        #region Public properties
        public Rectangle RegionInfo
        {
            get { return _regionInfo; }
            set { _regionInfo = value; }
        }
        #endregion

        #region Ctor
        public Region(Rectangle region)
        {
            _regionInfo = region;
        }
        public Region() { }
        #endregion

        protected override void FilterImplementation()
        {
            throw new NotImplementedException("Low level mode is not implemented");
        }

        public override void Apply(Bitmap b)
        {
            b = b.Clone(_regionInfo, b.PixelFormat);
        }

        public override Bitmap Convert(Bitmap b)
        {
            return b.Clone(_regionInfo, b.PixelFormat);
        }
    }
}
